/*****************************************************************************/
/*!	\file		PIS10CreateServerClient.h
 *	\brief		C Source code file for the YX-PIS Example
 *	\par		Dalian Yunxing Tech Co., Ltd.
 *
 *				Dalian, China
 *				Phone   : +86 (411) 8825 4852
 *				Email   : yx@yunxing.tech
 */
/*****************************************************************************/

#ifndef CLIENT_SERVER_FUNCTIONS_INCLUDED
#define CLIENT_SERVER_FUNCTIONS_INCLUDED 1

#include <stdio.h>
#include <stdlib.h>
#include "IEC61850Types.h"

/*!
 *	\brief	create a IEC61850 server object, using default parameters
 *
 *	\param[in]	options	the IEC61850_OptionFlag for creating the IEC61850 server object
 *
 *	\return	S_OK on success, or the corresponding error code returned by IEC61850_Create function
 */
IEC61850_ErrorCode CreateServer(unsigned long int options);

/*!
 *	\brief	create a IEC61850 client object, using default parameters
 *
 *	\param[in]	options	the IEC61850_OptionFlag for creating the IEC61850 client object
 *
 *	\return	S_OK on success, or the corresponding error code returned by IEC61850_Create function
 */
IEC61850_ErrorCode CreateClient();

/*!
 *	\brief	get the IEC61850 object
 *
 *	\return	the IEC61850 object, or NULL if invalid
 */
IEC61850 GetMyServerClient();

/*!
 *	\brief	set the IEC61850 object
 */
void SetMyServerClient(IEC61850 iec61850);

/*!
 *	\brief	check whether the IEC61850 object is not created yet
 *
 *	\return	1: the IEC61850 object is not created yet;
 *			0: the IEC61850 object is already created.
 */
int IsMyServerClientNULL();

/*!
 *	\brief	load the SCL file for the IEC61850 object
 *
 *	\param[in]	fileName	the full path to the SCL file, includes the file extension name
 *
 *	\return	S_OK on success, or the corresponding error code returned by IEC61850_LoadSCLFile function
 */
IEC61850_ErrorCode LoadSCLFile(char* fileName);

/*!
 *	\brief	run the IEC61850 object
 *
 *	\return	S_OK on success, or the corresponding error code returned by IEC61850_Start function
 */
IEC61850_ErrorCode StartMyServerClient();

/*!
 *	\brief	stop running the IEC61850 object
 *
 *	\return	S_OK on success, or the corresponding error code returned by IEC61850_Stop function
 */
IEC61850_ErrorCode StopMyServerClient();

/*!
 *	\brief	free the resources of the IEC61850 object
 *
 *	\return	S_OK on success, or the corresponding error code returned by IEC61850_Free function
 */
IEC61850_ErrorCode FreeMyServerClient();

/*!
 *	\brief	set the custom user data for the IEC61850 object to use in the callback functions
 *
 *	\param[in]	data	the customized user data address. the user data should be non-volatile
 *
 *	\return	S_OK on success, or the corresponding error code returned by IEC61850_Create function
 */
IEC61850_ErrorCode SetUserData(void* data);

/*!
 *	\brief	set the originator for controllable data objects of the IEC61850 object globally
 *
 *	\return	S_OK on success, or the corresponding error code returned by IEC61850_SetOriginator function
 */
IEC61850_ErrorCode SetControlsOrCat();

/*!
 *	\brief	register some example interface and methods for RpcCall
 *
 *	\return	S_OK on success, or other error codes indicating failure
 */
IEC61850_ErrorCode RPC_Create();

#endif
